package icu.lookyousmileface.nio.basic

import java.io.RandomAccessFile
import java.nio.ByteBuffer
import java.nio.channels.FileChannel

/**
 * @title: NioBufferMappedByteBuffer
 * @projectName NettyPro
 * @author shenj
 * @date 2020/12/1 12:21
 */
fun main(args: Array<String>) :Unit {

    val accessFile = RandomAccessFile("src/main/resources/filedata/data1.txt","rw")

    val fileChannel = accessFile.channel

    val channelMap = fileChannel.map(FileChannel.MapMode.READ_WRITE, 0, fileChannel.size())

    channelMap.put(1, 'I'.toByte())

    accessFile.close()
    fileChannel.close()

}